package com.ruoyi.project.system.domain.BeiDiao;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.system.domain.dto.JudiciaryDto;
import lombok.Data;

@Data
public class Judiciary extends Base {

    private Long crc;

    private JSONObject casesTree;

    private JSONObject count;

    private JSONObject preservationCount;

    private JSONArray preservationCases;

    private JSONObject administrativeCount;

    private JSONArray administrativeCases;

    private JSONObject civilCount;

    private JSONArray civilCases;

    private JSONObject implementCount;

    private JSONArray implementCases;

    private JSONObject criminalCount;

    private JSONArray criminalCases;

    private JSONObject bankruptCount;

    private JSONArray bankruptCases;

    public Judiciary(JudiciaryDto jd) {
        this.setId(jd.getId());
        this.setOrderNo(jd.getOrderNo());
        this.setMsg(jd.getMsg());
        this.setStatus(jd.getStatus());
        this.crc = jd.getCrc();
        this.casesTree = StringUtils.isEmpty(jd.getCasesTree()) ? null : JSONObject.parseObject(jd.getCasesTree());
        this.count = StringUtils.isEmpty(jd.getCount()) ? null : JSONObject.parseObject(jd.getCount());
        this.preservationCount = StringUtils.isEmpty(jd.getPreservationCount()) ? null : JSONObject.parseObject(jd.getPreservationCount());
        this.preservationCases = StringUtils.isEmpty(jd.getPreservationCases()) ? null : JSONArray.parse(jd.getPreservationCases());
        this.administrativeCount = StringUtils.isEmpty(jd.getAdministrativeCount()) ? null : JSONObject.parseObject(jd.getAdministrativeCount());
        this.administrativeCases = StringUtils.isEmpty(jd.getAdministrativeCases()) ? null : JSONArray.parse(jd.getAdministrativeCases());
        this.civilCount = StringUtils.isEmpty(jd.getCivilCount()) ? null : JSONObject.parseObject(jd.getCivilCount());
        this.civilCases = StringUtils.isEmpty(jd.getCivilCases()) ? null : JSONArray.parse(jd.getCivilCases());
        this.implementCount = StringUtils.isEmpty(jd.getImplementCount()) ? null : JSONObject.parseObject(jd.getImplementCount());
        this.implementCases = StringUtils.isEmpty(jd.getImplementCases()) ? null : JSONArray.parse(jd.getImplementCases());
        this.criminalCount = StringUtils.isEmpty(jd.getCriminalCount()) ? null : JSONObject.parseObject(jd.getCriminalCount());
        this.criminalCases = StringUtils.isEmpty(jd.getCriminalCases()) ? null : JSONArray.parse(jd.getCriminalCases());
        this.bankruptCount = StringUtils.isEmpty(jd.getBankruptCount()) ? null : JSONObject.parseObject(jd.getBankruptCount());
        this.bankruptCases = StringUtils.isEmpty(jd.getBankruptCases()) ? null : JSONArray.parse(jd.getBankruptCases());
    }
}
